﻿namespace SandScript.Test.Unit
{
    using SandScript.Test.Properties;
    using SandScript.Wrappers;
    using Xunit;

    public class BuilderTest
    {
        public class TestableBuilder : Testable<Builder>
        {
        }

        public class BuildReflection
        {
            [Fact]
            public void CallsGetTemporaryFolder_GivenHtmlFile()
            {
                var testable = new TestableBuilder();
                var fileSystemWrapper = testable.Mock<IFileSystemWrapper>();

                fileSystemWrapper.Setup(x => x.GetTemporaryFolder()).Returns("Temporary");
                fileSystemWrapper.Setup(x => x.GetText("test.html")).Returns(Resources.Documentation);
                fileSystemWrapper.Setup(x => x.FileExists(@"C:\Temp\test.js")).Returns(true);

                testable.Object.BuildReflection("test.html");

                fileSystemWrapper.Verify(x => x.GetTemporaryFolder());
                fileSystemWrapper.Verify(x => x.GetText("test.html"));
            }
        }
    }
}
